package com.hy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.hy.domain.Service;

@Controller
public class NewServiceController {
	
	@RequestMapping("/hyfw/view/{id}")
	public String view(@PathVariable long id, Model model) {
		Service service = Service.findService(id);
		service.setHits(service.getHits() + 1);
		service.merge();
		model.addAttribute("service", service);
		model.addAttribute("prev", service.prev());
		model.addAttribute("next", service.next());
		return "hyfw_xq";
	}
	
}
